<template>
  <div id="marketinglist" > 
          <el-table :data="datalist" style="width: 100%" :row-class-name="tableRowClassName" 
           :border="true" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
          >
                 <el-table-column label="手机号"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.telphone }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="姓名"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.nickname }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="操作" align='center' width="450px"  fixed="right">
                    <template slot-scope="scope">
                        <el-button size="mini"  type="primary"  plain class="button_class1" @click="delect_but(scope.row)">删除</el-button> 
                        <el-button size="mini"  type="primary"  plain class="button_class2" @click="mtk1_but(scope.row)">虚拟添加</el-button>
                        <el-button size="mini"  type="primary"  plain class="button_class1" @click="go_but1(scope.row)">获奖记录</el-button>
                        <el-button size="mini"  type="primary"  plain class="button_class2" @click="go_but2(scope.row)">好友展示</el-button>
                    </template>
                </el-table-column>
            </el-table>  
             <!-- 虚拟添加 -->
    <el-dialog title="虚拟添加" :visible.sync="mtk1"  width="400px">
        <div style="width:100%;"> 

        <el-form ref="form"   label-width="80px" style="width:100%;">
    
             <el-form-item label="总产出">
                    <el-input    v-model="mtk1_form.all_produced" placeholder="请输入总产出"></el-input>
              </el-form-item> 
              <el-form-item label="累计产出">
                    <el-input    v-model="mtk1_form.week_produced" placeholder="请输入本周累计产出"></el-input>
              </el-form-item> 
              <el-form-item label="好友人数">
                    <el-input    v-model="mtk1_form.friend_num" placeholder="请输入好友人数"></el-input>
              </el-form-item> 
               <el-form-item label="累积获得">
                    <el-input    v-model="mtk1_form.accumulative_total" placeholder="请输入累积获得"></el-input>
              </el-form-item> 

            <div style="text-align: center;width:50%;margin:auto;">
                <el-button type="primary" class="custom_color_button" style="width:80%;" @click="mtk1_but_qr">确认</el-button>
            </div>
         </el-form>
        </div> 
    </el-dialog>
 
   </div>
</template>

<script>
export default {
   name: 'marketinglist',
   props:{
      datalist:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
        mtk1:false,
        mtk1_form:{
           all_produced:'',
           week_produced:'',
           friend_num:'',
           accumulative_total:'',
        },
        mkid:'',
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 293
      
  },
  mounted (){
   
  },
  methods: {
      mtk1_but(row){
        this.mkid = row.mkid
        this.mtk1_form.all_produced = row.all_produced
        this.mtk1_form.week_produced = row.week_produced
        this.mtk1_form.friend_num = row.friend_num
        this.mtk1_form.accumulative_total = row.accumulative_total
        this.mtk1 = true
      },
      mtk1_but_qr(){
         this.post("/marketer/changeVrData", {
            mkid:this.mkid,
            all_produced:this.mtk1_form.all_produced,
            week_produced:this.mtk1_form.week_produced,
            friend_num:this.mtk1_form.friend_num,
            accumulative_total:this.mtk1_form.accumulative_total,
	          }).then(res => {

              if(res.error_code == 0){
                  this.open1(res.result,'success')  //提示框
                  this.$emit('up_list_fun')
                  this.mtk1 = false
              }else {
                  this.open1(res.message,'warning')
              }
       

            })
      },
      delect_but(row){
       
        this.$confirm('是否删除?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
             this.post("/marketer/delete", {
                    mkid:row.mkid,
                }).then(res => {
                    if(res.error_code == 0){
                      this.open1(res.result,'success')  //提示框
                     this.$emit('up_list_fun')
                     
                    }else {
                    this.open1(res.message,'warning')
                    }

              })
        })


    },
      go_but1(row){
       this.$router.push({
          path: '/index/marketing/awardwinning',
          query: {
             name:row.telphone,
             mkid:row.mkid
          }
        })
    },
     go_but2(row){
       this.$router.push({
          path: '/index/marketing/addfriend',
          query: {
             name:row.telphone,
             mkid:row.mkid
          }
        })
    },

  }
}
</script>


<style scoped>

</style>